home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / develop / libsrc11.arc / WRBYTSCI.C < prev    next >
C/C++ Source or Header  |  1989-04-27  |  978b  |  45 lines

  1. /*    wrbytsci.c 4.3        */
  2. /*F****************************************************************************
  3.  
  4. FUNCTION NAME:    wrbytsci
  5.  
  6. ACTION:        Writes a character from the SCI serial hardware.
  7.         Format of the integer argument passed is:
  8.             Bits 15-9 = not used
  9.             Bit     8 = ninth data bit
  10.             Bits  7-0 = low 8 bits of data
  11.  
  12. PARAMETERS:
  13.         byte_value:    value to be output to the SCI port
  14.                 (can be 8 or 9 bit value).
  15.  
  16. RETURNS:    (void)
  17.  
  18. ******************************************************************************/
  19.  
  20. #define    NINTH_BIT    0x100    /* Ninth data bit */
  21.  
  22. #include <hc11/io.h>
  23. #include <hc11/sci.h>
  24. #include <hc11/directives.h>
  25.  
  26. SMALL
  27. void wrbytsci(byte_value)
  28.  
  29.     int    byte_value;
  30.  
  31.     {
  32.  
  33.  
  34.     while ((HC11.SCSRDAT.STATUS & TDRE) ==  0)
  35.         ;    /* null statement */
  36.  
  37.     HC11.SCSRDAT.DATAREG = byte_value;
  38.  
  39.     if (byte_value & NINTH_BIT)
  40.         HC11.SCCR1 |= T8;    /*    set the bit    */
  41.     else
  42.         HC11.SCCR1 &= (~T8);    /*    clear the bit    */
  43.  
  44.     }    /* end of wrbytsci    */
  45.